package com.fis.mca.client;

import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.namespace.QName;

import com.fis.mca.advertisement.AdvertisementTransferer;
import com.fis.mca.advertisement.AdvertisementTransfererService;
import com.fis.mca.config.Config;
import com.fis.mca.config.ConfigConstant;
import com.fis.mca.interaction.InteractionTransferer;
import com.fis.mca.interaction.InteractionTransfererService;


public class AdvertisementTransfererClient
{
	private static final QName SERVICE_NAME = new QName("http://advertisement.mca.fis.com/", "AdvertisementTransfererService");
	private static final String WSDL_URL = Config
			.getURL(ConfigConstant.ADVERTISEMENT_PORT_KEY);
	
	private static final AdvertisementTransferer port;
	private static final AdvertisementTransfererService ss;
	
	private AdvertisementTransfererClient()
	{
	}
	
	static
	{
		URL url = null;
		try
		{
			url = new URL(WSDL_URL);
		}
		catch (MalformedURLException e)
		{
			java.util.logging.Logger.getLogger(
					AdvertisementTransfererClient.class.getName()).log(
					java.util.logging.Level.INFO,
					"Can not initialize the default wsdl from {0}", WSDL_URL);
		}
		
		ss = new AdvertisementTransfererService(url, SERVICE_NAME);
		port = ss.getAdvertisementTransfererPort();
	}
	
	public static AdvertisementTransferer getService()
	{
		return port;
	}
}
